package mqConsumer

import (
	"github.com/Sir-yuChen/funAnalyse/global"
	mqConstant "github.com/Sir-yuChen/funAnalyse/global/mq"
	"github.com/Sir-yuChen/funAnalyse/service/mqConsumer"
	"github.com/Sir-yuChen/funAnalyse/utils/kafka"
	"github.com/Sir-yuChen/funAnalyse/utils/rabbitMq"
)

// InitListenMq 对mq队列的监听
func InitListenMq() {

	//RabbitMq处理好友请求
	chatQueueExchange := rabbitMq.QueueExchange{
		QuName: mqConstant.MQ_QUEUE_CHAT,
		RtKey:  mqConstant.MQ_ROUTING_KEY_CHAT_1,
		ExName: mqConstant.MQ_EXCHANG,
		ExType: mqConstant.MQ_EX_TYPE_direct,
	}
	go rabbitMq.Recv(chatQueueExchange, &mqConsumer.CommunicationConsumerHandle{}, 1)
	//kafka 消息推送
	go kafka.KafkaRecv(
		global.GVA_CONFIG.KafkaConfig.Link,
		[]string{mqConstant.MQ_KAFKA_BULLETI},
		mqConstant.MQ_KAFKA_BULLETI_GROUPNAME,
		&mqConsumer.BulletinKafkaConsumerHandle{},
		1,
	)

	//kafka 发送消息
	go kafka.KafkaRecv(
		global.GVA_CONFIG.KafkaConfig.Link,
		[]string{mqConstant.MQ_KAFKA_CHAT_MSG},
		mqConstant.MQ_KAFKA_CHAT_MSG_GROUPNAME,
		&mqConsumer.CommunicationMsgConsumer{},
		10,
	)

}
